import * as XLSX from 'xlsx';


export const generateXLSX = async (data, name) => {
    const worksheet = XLSX.utils.aoa_to_sheet(data);
    // 创建工作簿
    const workbook = XLSX.utils.book_new();
    XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
    // 导出为 xlsx 文件
    XLSX.writeFile(workbook, `${name}.xlsx`);
}
export default generateXLSX;